1. Technical Field
The present invention relates to an image compressing method, an image compressing apparatus, and an image forming apparatus in which an image is compressed.
2. Description of Related Art
In recent years, digital image systems have been remarkably developed, and establishment of digital image processing techniques have been advanced. For example, in the field of digital copiers and digital multi-function peripherals, electronic data obtained by reading a document of a manuscript with a scanner is stored as a document file, or the stored document file is managed. Further, the document file is compressed, and transmitted by e-mail. In general, an image read by a scanner (hereinafter referred to as a scanned image) has a large file size, and hence it is essential to compress the scanned image in order to store or transmit the scanned image.
As one compression technique for compressing a scanned image at a high compression ratio, an image compression technique on the basis of layer separation (e.g., MRC: Mixed Raster Content) has been put into practical use. In the image compression technique on the basis of layer separation, a foreground mask corresponding to a text and/or a line art is extracted from a scanned image to be compressed, the scanned image is separated into a foreground layer and a background layer on the basis of the extracted foreground mask, and the foreground layer and the background layer are compressed by employing respective suitable compression techniques, whereby a highly compressed image is finally generated (see Japanese Patent Application Laid-Open No. 2002-94805 and Japanese Patent No. 3779741).
At this point, a foreground layer is a layer of a foreground corresponding to a text and/or a line art, and is generally compressed by employing a lossless compression technique such as JBIG (Joint Bilevel Image Group), MMR (Modified Modified Read code), LZW (Lempel Ziv Welch), or the like. On the other hand, a background layer is a layer of a background corresponding to an image content other than the text and/or the line art, and is generally compressed by employing a lossy compression technique such as JPEG (Joint Photographic Experts Group) or the like.
Since a compression ratio is easily controlled in the lossy compression technique, priority can be placed on a file size or an image quality in accordance with use of a compressed image. However, since the compression ratio is difficult to control in the lossless compression technique, it is difficult to improve the compression ratio. Accordingly, there has been proposed an image compressing apparatus in which the foreground layer is further separated into a plurality of rectangular regions before being compressed. In each of rectangular regions, a foreground having a specific color, and an area other than the foreground having the specific color are binarized. Consequently, the compression ratio can be improved as compared with the case where a foreground layer including a foreground having a plurality of colors is directly compressed (Japanese Patent Application Laid-Open No. 2003-18412).
For example, in an image compressing apparatus described in Japanese Patent Application Laid Open No. 2003-18412, a document image is converted into a binary image, and a plurality of rectangular regions each including a text are extracted from the binary image. Colors of individual texts included in the extracted rectangular regions are extracted from the document image. When a plurality of text colors are included in each rectangular region, the image compressing apparatus extracts a rectangular region including a text in a specific color from the rectangular region.
Further, the image compressing apparatus appropriately merges rectangular regions each including the text in the specific color before compressing them. Note that the image compressing apparatus merges rectangular regions when a data size obtained when the compression is performed in a state where rectangular regions are not merged is larger than a data size obtained when the compression is performed in a state where rectangular regions are merged. In addition, when the rectangular regions are merged, the image compressing apparatus determines whether or not the mergence is to be performed on a round-robin basis.